package com.filepublic.demo.common.util;

import com.filepublic.demo.common.constant.EmailTextConstant;
import org.springframework.mail.SimpleMailMessage;

/**
 * email工具
 */
public class EmailUtil {

    /**
     * 生成发送的消息对象
     */
    public static SimpleMailMessage buildText(String emailUser){
        //核心类
        SimpleMailMessage message = new SimpleMailMessage();

        message.setFrom(EmailTextConstant.SEND_FROM);//邮件发送方
        message.setTo(emailUser);//邮件接收方
        message.setSubject(EmailTextConstant.SEND_TITLE);//题目
        return message;
    }


    /**
     * 生成随机五位验证码
     * @return
     */
    public static String buildCaptcha(){
        return (int)(9999+Math.random()*99999)+"";
    }
}
